package com.easyspringboot.bulider;

import com.easyspringboot.bean.Constants;
import com.easyspringboot.utils.DateUtils;

import java.io.BufferedWriter;
import java.util.Date;

/**
 * @Author xiaoyi
 * @Version 1.0
 * @ClassName BuildComment
 * @Time 23:40
 */
public class BuildComment {

    public static void createClassComment(BufferedWriter bw,String tableName) throws Exception {
        bw.write("/**");
        bw.newLine();
        bw.write(" * @Description "+tableName);
        bw.newLine();
        bw.write(" * @Author "+ Constants.AUTHOR_COMMENT);
        bw.newLine();
        bw.write(" * @Version "+System.getProperty("java.version"));
        bw.newLine();
        bw.write(" * @date "+ DateUtils.format(new Date(), DateUtils._YYYYMMDD));
        bw.newLine();
        bw.write(" */");
        bw.newLine();
    }

    public static void createMethodComment(BufferedWriter bw,String methodName) throws Exception {
            bw.write("\t/**");
            bw.newLine();
            bw.write("\t * "+methodName);
            bw.newLine();
            bw.write("\t * @param ");
            bw.newLine();
            bw.write("\t * @return ");
            bw.newLine();
            bw.write("\t */");
            bw.newLine();

    }
    public static void createFieldComment(BufferedWriter bw,String fileComment) throws Exception{
        if (fileComment==null||"".equals(fileComment)){
            fileComment = " ";
        }
        bw.write("\t/**");
        bw.newLine();
        bw.write("\t * "+fileComment);
        bw.newLine();
        bw.write("\t */");
        bw.newLine();



    }
}
